package eteam.aps.controller;

import eteam.aps.common.R;
import eteam.aps.common.exceptions.AuthException;
import eteam.aps.common.helper.JsonPage;
import eteam.aps.model.entity.DataDictionary;
import eteam.aps.model.vo.DataDictionaryCategoryTreeVo;
import eteam.aps.model.vo.DataDictionaryVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface IDataDictionaryController {

	@PostMapping("/dd/insert")
	R<Integer> insert(@RequestBody DataDictionary dictionary) throws Exception, AuthException;

	@PostMapping("/ddc/delete/{fId}")
	R<Integer> delete(@PathVariable String fId) throws Exception, AuthException;

	@PostMapping("/dd/update")
	R<Integer> update(@RequestBody DataDictionary dictionary) throws Exception, AuthException;

	/**
	 * 分页 模糊 查询
	 *
	 * @param fDdcId   字典分类的主键 必传
	 * @param fDdCode  字典编码
	 * @param fDdName  字典名称
	 * @param page     第几页 从1开始 必传
	 * @param pageSize 每页条数 必传
	 * @return 字典 详情
	 * @throws Exception     顶级异常
	 * @throws AuthException 授权异常
	 */
	@PostMapping("/dd/selectAll")
	R<JsonPage<DataDictionaryVo>> selectAll(@RequestParam("fDdcId") String fDdcId,
			@RequestParam(value = "fDdCode", required = false) String fDdCode,
			@RequestParam(value = "fDdName", required = false) String fDdName, @RequestParam("page") Integer page,
			@RequestParam("pageSize") Integer pageSize) throws Exception, AuthException;

	@PostMapping("/dd/selectDetails/{fId}")
	R<DataDictionaryVo> selectDetails(@PathVariable String fId) throws Exception, AuthException;

	@PostMapping("/dd/selectFDdcTree")
	List<DataDictionaryCategoryTreeVo> selectFDdcTree() throws Exception, AuthException;
}
